java.lang.Objectjava.util.Observable
org.nlogo.agent.Agent
org.nlogo.agent.Link
public class Link
| Field Summary | |
|---|---|
static int |
BIT
|
static Double |
DEFAULT_COLOR
|
int |
LAST_PREDEFINED_VAR
|
static String |
MODE_FIXED
|
static String |
MODE_FREE
|
static String |
MODE_NONE
|
int |
NUMBER_PREDEFINED_VARS
|
static int |
VAR_BREED
|
static int |
VAR_COLOR
|
static int |
VAR_END1
|
static int |
VAR_END2
|
static int |
VAR_LABEL
|
static int |
VAR_SHAPE
|
static int |
VAR_THICKNESS
|
static int |
VAR_TIEMODE
|
| Fields inherited from class org.nlogo.agent.Agent |
|---|
id, variables |
| Constructor Summary | |
|---|---|
Link(World world,
Turtle end1,
Turtle end2,
int arraySize)
|
|
| Method Summary | |
|---|---|
Object |
agentKey()
|
AgentSet |
bothEnds()
|
Shape |
cachedShape()
|
void |
cachedShape(Shape newShape)
|
String |
classDisplayName()
Returns a displayable name of this type of agent (Turtle, Link, Patch, Observer) |
Object |
color()
Returns the value of the color variable |
void |
color(LogoList rgb)
|
void |
colorDouble(Double boxedColor)
|
void |
colorDoubleUnchecked(Double boxedColor)
|
int |
compareTo(Agent a)
|
void |
die()
|
Turtle |
end1()
Returns the first end point of this link. |
Turtle |
end2()
Returns the second end point of this link. |
int |
getAgentBit()
|
Class<Link> |
getAgentClass()
|
AgentSet |
getBreed()
Returns the breed AgentSet associated with this link, if the link is unbreeded returns the all links AgentSet |
int |
getBreedIndex()
Returns the index of the breed of this link |
Object |
getBreedVariable(String name)
|
Object |
getLinkBreedVariable(String name)
|
Object |
getLinkVariable(int vn)
|
double |
getLinkVariableDouble(int vn)
|
Object |
getObserverVariable(int vn)
|
Patch |
getPatchAtOffsets(double dx,
double dy)
|
Object |
getPatchVariable(int vn)
|
Object |
getTurtleOrLinkVariable(String varName)
|
Object |
getTurtleVariable(int vn)
|
Object |
getVariable(int vn)
Returns the value of the variable in the given position of the agent variable array |
boolean |
hasLabel()
Returns true if there is a value in the label variable |
double |
heading()
Returns the heading towards end2 from end1 |
boolean |
hidden()
Returns the value of the hidden? |
void |
hidden(boolean hidden)
|
boolean |
isDirectedLink()
Returns true if this link is directed |
boolean |
isTied()
|
Object |
label()
|
void |
label(Object label)
|
Object |
labelColor()
Returns the value of the label-color variable |
void |
labelColor(double labelColor)
|
void |
labelColor(LogoList rgb)
|
String |
labelString()
Returns the value of the label variable |
double |
lineThickness()
Returns the value of the thinkness variable |
void |
lineThickness(Double value)
|
double |
linkDestinationSize()
Returns the size of end2 |
double |
midpointX()
Returns the x-coordinate of the midpoint of this link taking wrapping in account. |
double |
midpointY()
Returns the y-coordinate of the midpoint of this link taking wrapping in account. |
String |
mode()
|
void |
mode(String mode)
|
void |
setBreed(AgentSet breed)
|
void |
setBreedVariable(int vn,
double value)
|
void |
setBreedVariable(String name,
Object value)
|
void |
setLinkBreedVariable(String name,
Object value)
|
void |
setLinkVariable(int vn,
double value)
|
void |
setLinkVariable(int vn,
Object value)
|
void |
setObserverVariable(int vn,
Object value)
|
void |
setPatchVariable(int vn,
double value)
|
void |
setPatchVariable(int vn,
Object value)
|
void |
setTurtleOrLinkVariable(String varName,
Object value)
|
void |
setTurtleVariable(int vn,
double value)
|
void |
setTurtleVariable(int vn,
Object value)
|
void |
setVariable(int vn,
Object value)
Sets the variable in the position vn of the agent variable array to value |
String |
shape()
Returns the name of the current shape, empty string in the case of patches. |
void |
shape(String shape)
|
double |
size()
Returns the size of this agent |
String |
toString()
|
void |
untie()
|
double |
x1()
Returns the x-coordinate of end1 |
double |
x2()
Returns the x-coordinate of end2 this coordinate is "unwrapped" so it may actually be outside the bounds of the world |
double |
y1()
Returns the y-coordinate of end1 |
double |
y2()
Returns the y-coordinate of end2 this coordinate is "unwrapped" so it may actually be outside the bounds of the world |
| Methods inherited from class org.nlogo.agent.Agent |
|---|
getVariableCount, id, variableConstraint, variableConstraint, world |
| Methods inherited from class java.util.Observable |
|---|
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.nlogo.api.Agent |
|---|
id, world |
| Field Detail |
|---|
public static final int VAR_END1
public static final int VAR_END2
public static final int VAR_COLOR
public static final int VAR_LABEL
public static final int VAR_BREED
public static final int VAR_THICKNESS
public static final int VAR_SHAPE
public static final int VAR_TIEMODE
public int LAST_PREDEFINED_VAR
public int NUMBER_PREDEFINED_VARS
public static final Double DEFAULT_COLOR
public static final String MODE_NONE
public static final String MODE_FREE
public static final String MODE_FIXED
public static final int BIT
| Constructor Detail |
|---|
public Link(World world,
Turtle end1,
Turtle end2,
int arraySize)
| Method Detail |
|---|
public Turtle end1()
Link
end1 in interface Linkpublic Turtle end2()
Link
end2 in interface Linkpublic Object agentKey()
public void die()
public Object getVariable(int vn)
Agent
getVariable in interface AgentgetVariable in class Agentvn - the index into the agent variable arraypublic Object getTurtleOrLinkVariable(String varName)
getTurtleOrLinkVariable in class Agent
public void setVariable(int vn,
Object value)
throws AgentException
Agent
setVariable in interface AgentsetVariable in class Agentvn - the index into the agent variable arrayvalue - the new value for the variable
AgentException - If value is the wrong type for the given variable or if you try to change variables that cannot be changedpublic Object getObserverVariable(int vn)
getObserverVariable in class Agentpublic Object getLinkVariable(int vn)
getLinkVariable in class Agentpublic double getLinkVariableDouble(int vn)
public void setObserverVariable(int vn,
Object value)
throws AgentException,
LogoException
setObserverVariable in class AgentAgentException
LogoException
public void setTurtleOrLinkVariable(String varName,
Object value)
throws AgentException
setTurtleOrLinkVariable in class AgentAgentException
public void setLinkVariable(int vn,
double value)
setLinkVariable in class Agent
public void setLinkVariable(int vn,
Object value)
throws AgentException
setLinkVariable in class AgentAgentException
public Object getTurtleVariable(int vn)
throws AgentException
getTurtleVariable in class AgentAgentException
public Object getBreedVariable(String name)
throws AgentException
getBreedVariable in class AgentAgentException
public Object getLinkBreedVariable(String name)
throws AgentException
getLinkBreedVariable in class AgentAgentException
public Object getPatchVariable(int vn)
throws AgentException
getPatchVariable in class AgentAgentException
public void setTurtleVariable(int vn,
Object value)
throws AgentException
setTurtleVariable in class AgentAgentException
public void setTurtleVariable(int vn,
double value)
throws AgentException
setTurtleVariable in class AgentAgentException
public void setBreedVariable(String name,
Object value)
throws AgentException
setBreedVariable in class AgentAgentException
public void setBreedVariable(int vn,
double value)
throws AgentException
AgentException
public void setLinkBreedVariable(String name,
Object value)
throws AgentException
setLinkBreedVariable in class AgentAgentException
public void setPatchVariable(int vn,
Object value)
throws AgentException
setPatchVariable in class AgentAgentException
public void setPatchVariable(int vn,
double value)
throws AgentException
setPatchVariable in class AgentAgentExceptionpublic double x1()
Link
x1 in interface Linkpublic double y1()
Link
y1 in interface Linkpublic double x2()
Link
x2 in interface Linkpublic double y2()
Link
y2 in interface Linkpublic double midpointX()
Link
midpointX in interface Linkpublic double midpointY()
Link
midpointY in interface Linkpublic double heading()
Link
heading in interface Linkpublic double lineThickness()
Linkthinkness variable
lineThickness in interface Linkpublic void lineThickness(Double value)
public boolean isDirectedLink()
Link
isDirectedLink in interface Linkpublic double linkDestinationSize()
Link
linkDestinationSize in interface Linkpublic double size()
Agent
size in interface Agentpublic Shape cachedShape()
public void cachedShape(Shape newShape)
public String shape()
Agent
shape in interface Agentpublic void shape(String shape)
public String mode()
public void mode(String mode)
public boolean isTied()
public void untie()
public Object color()
Linkcolor variable
color in interface Linkpublic void colorDouble(Double boxedColor)
public void colorDoubleUnchecked(Double boxedColor)
public void color(LogoList rgb)
throws AgentException
AgentExceptionpublic AgentSet bothEnds()
public Patch getPatchAtOffsets(double dx,
double dy)
throws AgentException
getPatchAtOffsets in class AgentAgentExceptionpublic Object label()
public boolean hasLabel()
Linklabel variable
hasLabel in interface Linkpublic String labelString()
Linklabel variable
labelString in interface Linkpublic void label(Object label)
public boolean hidden()
Linkhidden? variable
hidden in interface Linkpublic void hidden(boolean hidden)
public AgentSet getBreed()
Link
getBreed in interface Linkpublic Object labelColor()
Linklabel-color variable
labelColor in interface Linkpublic void labelColor(double labelColor)
public void labelColor(LogoList rgb)
throws AgentException
AgentExceptionpublic String toString()
toString in class Objectpublic String classDisplayName()
Agent
classDisplayName in interface AgentclassDisplayName in class Agentpublic Class<Link> getAgentClass()
getAgentClass in class Agentpublic int getAgentBit()
getAgentBit in class Agentpublic void setBreed(AgentSet breed)
public int getBreedIndex()
Link
getBreedIndex in interface Linkpublic int compareTo(Agent a)
compareTo in interface Comparable<Agent>compareTo in class Agent